package com.mixsmart.core.service.impl;

import java.io.Serializable;
import java.util.ArrayList;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.mixsmart.core.bean.entity.IEntityBean;
import com.mixsmart.core.service.IMgrService;
import com.mixsmart.core.service.IResExecuteService;
import com.mixsmart.spellsql.ICondition;

/**
 * 管理服务实现类
 * @author lmq
 * @version 1.0
 * @since JDK版本大于等于1.6
 * 2016年1月15日
 * @param <T>
 * @param <PK>
 */
public class MgrService<T extends IEntityBean, PK extends Serializable> extends BaseService<T, PK> implements IMgrService<T, PK> {

	@Autowired
	private IResExecuteService executeServ;
	
	@Override
	@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
	public boolean save(T t){
		return super.dao.save(t);
	}
	
	@Override
	@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
	public boolean saveOrUpdate(T t) {
		return super.dao.saveOrUpdate(t);
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
	public boolean save(ArrayList<T> ts) {
		return super.dao.save(ts);
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
	public boolean update(T t) {
		return super.dao.update(t);
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
	public boolean saveObj(IEntityBean bean) {
		return super.dao.saveObj(bean);
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
	public boolean saveObj(ArrayList<? extends IEntityBean> beans) {
		return super.dao.saveObj(beans);
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
	public boolean updateObj(IEntityBean bean) {
		return super.dao.updateObj(bean);
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
	public boolean delete(PK id) {
		return super.dao.delete(id);
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
	public boolean delete(Class<? extends IEntityBean> clazz, PK id) {
		return super.dao.delete(clazz, id);
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
	public boolean delete(ICondition condition) {
		return super.dao.delete(condition);
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
	public boolean delete(Class<? extends IEntityBean> clazz, ICondition condition) {
		return super.dao.delete(clazz, condition);
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
	public boolean delete(PK[] ids) {
		return super.dao.delete(ids);
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
	public boolean delete(Class<? extends IEntityBean> clazz, PK[] ids) {
		return super.dao.delete(clazz, ids);
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
	public boolean update(ArrayList<T> ts) {
		return super.dao.update(ts);
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
	public boolean updateObj(ArrayList<IEntityBean> beans) {
		return super.dao.updateObj(beans);
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
	public boolean delete(T t) {
		return super.dao.delete(t);
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED, readOnly=false)
	public boolean delete(ArrayList<T> ts) {
		return super.dao.delete(ts);
	}

	protected IResExecuteService getExecuteServ() {
		return executeServ;
	}
	
}
